<?php use_helper('I18N') ?>
<script type="text/javascript">
function formchecking(){	
	var txtusername = document.getElementById('username').value;
	var txtpassword = document.getElementById('password').value;
	var txtpassword1 = document.getElementById('password1').value;
	var txtpassword2 = document.getElementById('password2').value;
	
	if (txtusername.length <= 0) {
		alert('Please enter your username');
		return false;
	} else if (txtpassword1!=txtpassword2) {
		document.getElementById('password1').value="";
		document.getElementById('password2').value="";
		alert('Password not match');
		return false;
	} else {
		if (txtpassword.length <= 0 || txtpassword1.length <= 0 || txtpassword2.length <= 0) {
			alert('Please enter your password');
			return false;
		}
	}
	
	document.getElementById('frmlogin').submit();
}
</script>

<?php echo form_tag('user/changepass', array('id' => 'frmlogin', 'name' => 'frmlogin')) ?>

<table class="main">
	<tr>
    	<td valign="top"><img src="/images/welcome.jpg" /></td>
        <td><img src="/images/divider.jpg" /></td>
        <td valign="top" align="center"><img src="/images/logo.jpg" />
        	<br /><br />
            <?php
			if($success_message=="success"){
			?>	
            <span class="title">THANK YOU</span>
            <br />
            You had successfully updated your password.
            <br /><br />
            Please click <a href="/user/login">here</a> to login
            <?php
			}else{
			?>
            <span class="title">PLEASE ENTER YOUR DETAILS</span>
            <br /><br />
            <table width="240">
            	<tr>
                	<td align="left" colspan="2">User Name:</td>
                </tr>
                <tr>
                	<td colspan="2" align="left"><?php echo input_tag('username') ?></td>
                </tr>
                <tr>
                	<td align="left" colspan="2">Current Password:</td>
                </tr>
                <tr>
                	<td colspan="2" align="left"><?php echo input_password_tag('password') ?></td>
                </tr>
                <tr>
                	<td align="left" colspan="2">New Password:</td>
                </tr>
                <tr>
                	<td colspan="2" align="left"><?php echo input_password_tag('password1') ?></td>
                </tr>
                <tr>
                	<td align="left" colspan="2">Confirm New Password:</td>
                </tr>
                <tr>
                	<td colspan="2" align="left"><?php echo input_password_tag('password2') ?></td>
                </tr>
                <tr>
                	<td align="left"><img name="btnLogin" id="btnLogin" onmouseover="roll_over('btnLogin', '/images/change_btnAF.jpg')" onmouseout="roll_over('btnLogin', '/images/change_btn.jpg')" src="/images/change_btn.jpg" onClick="return formchecking();"/></td>
                	<td align="left"><img name="btnCancel" id="btnCancel" onmouseover="roll_over('btnCancel', '/images/back_btnAF.jpg')" onmouseout="roll_over('btnCancel', '/images/back_btn.jpg')" src="/images/back_btn.jpg" onClick="location.href='/user/login'"/></td>
                </tr>
                <tr>
                	<td colspan="2" class="error" align="left">
					<?php
						if(!empty($error_message)){
							echo $error_message;
							$error_message='';
						}
					?>
					</td>
                </tr>
            </table>
            <?php
			}
			?>
        </td>
    </tr>
</table>

</form>
